-
Notifications
You must be signed in to change notification settings - Fork 29
Optimise SSZ encoding and decoding #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #55 +/- ##
==========================================
- Coverage 57.18% 57.10% -0.09%
==========================================
Files 10 10
Lines 313 345 +32
==========================================
+ Hits 179 197 +18
- Misses 134 148 +14 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Unfortunately yes the Miri flags it as UB and the test also fails (we decode integers like 2 "successfully" as bools) |
|
Gonna try using |
|
Ok nice, we didn't actually need an |
|
Updated the benchmark results in the OP, there are some slower benches for encoding, but I think this is just noise. We haven't changed the encoding codepath at all. |
paulhauner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the unsafe stuff looks good to me 👍
I don't understand the chunks to chunks_exact change, but perhaps I'm missing something.
I think this is overall a worthwhile improvement and the added unsafe code is (a) small enough to be easily reasoned about and (b) worth reasoning about.
Co-authored-by: Paul Hauner <[email protected]>
Summary of changes
unsafefast path for decoding lists and vectors ofu8chunks_exactand an explicit loop instead oftry_fold.Benchmarks
Additional Info
Depends on a new release of
ethereum_sszfor:Encoding is not meaningfully faster, but would need to be optimised in
sszitself (we need to optimise theVecimpl).